<?php

use Illuminate\Http\Request;
use Illuminate\Routing\Router;


Route::post('logout', 'Auth\LoginController@logout');
Route::post('login', 'Auth\LoginController@login')->name('login');

Route::get('year_scores_export', 'ExcelController@year_scores_export')->name('year_scores_export');
Route::get('user_scores_export', 'ExcelController@user_scores_export')->name('user_scores_export');
Route::get('year_scores_all', 'ExcelController@year_scores_all')->name('year_scores_all');
Route::get('reate_year','\App\Http\Controllers\Api\UserController@createYear')->name('apo_create_year');
Route::get('dreate_score','\App\Http\Controllers\Api\ScoreController@createScore')->name('api_create_year');
Route::group(['middleware' => ['auth:api'], 'namespace' => 'Api'], function (Router $router) {

    $router->get('/user_info', function (Request $request) {
        return $request->user();
    });

    $router->resource('departments', 'DepartmentController', ['except' => ['create', 'edit']]);
    $router->get('departments_all', 'DepartmentController@all')->name('departments_all');
    $router->get('posts_all', 'PostController@all')->name('posts_all');
    $router->resource('posts', 'PostController', ['except' => ['create', 'edit']]);
    $router->resource('users', 'UserController', ['except' => ['create', 'edit' ,'destroy']]);
    $router->get('roles', 'UserController@roles')->name('roles');
    $router->delete('users', 'UserController@delete')->name('users.delete');
    $router->put('initialise/{id}','UserController@initialise')->name('user.initialise');
    $router->put('user/reset_password','UserController@reset_password')->name('user.reset_password');
    $router->resource('scores', 'ScoreController', ['only' => ['store']]);
    $router->get('user_scores', 'ScoreController@user_scores')->name('user_scores');
    $router->get('year_list', 'ScoreController@year_list')->name('year_list');
    $router->get('year_scores', 'ScoreController@year_scores')->name('year_scores');
    $router->get('score_user_list', 'ScoreController@score_user_list')->name('score_user_list');
    $router->get('year_user_score', 'ScoreController@year_user_score')->name('year_user_score');
    $router->get('year_score_list', 'ScoreController@year_score_list')->name('year_score_list');
    $router->resource('configs', 'ConfigController', ['except' => ['create', 'edit', 'destroy']]);
    // 开启考核
    $router::get('/create_year','UserController@createYear');
    // 评分结算
    $router->get('/create_score','ScoreController@createScore');
});